package thread.threaddemo;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @Author: wenjingyuan
 * @Date: 2022/11/19/21:41
 * @Description:
 */
public class ThreadLock3 {
    public static void main(String[] args) {
        Lock lock=new ReentrantLock();
        try{
            System.out.println("进入try");
            System.out.println("执行lock");
            lock.lock();
            int n=10/0;
            System.out.println("执行lock");
            lock.lock();
        }finally {
            System.out.println("执行unlock");
            lock.unlock();
        }
    }
}
